package pageObject;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import utils.ReportWriter;

public class UserPage extends BasePage {
    protected UserPage(WebDriver driver) {
        super(driver);
    }

    public boolean checkRegistration (String userName) {
        boolean success = false;
        try {
            if (driver.findElement(By.xpath("//div[.='" + userName + "']")).isDisplayed()) {
                ReportWriter.info(userName + " is registered!");
                success = true;
            }
        } catch (Exception ex) {
            ReportWriter.logElementNotPresent("user name " + userName);
            ReportWriter.info("Element with user name '" + userName + "' was not found!");
            success = false;
        }
        return success;
    }
}
